﻿#include "SnapForm.h"
#include "ui_SnapForm.h"

SnapForm::SnapForm(QWidget* parent)
    : QWidget(parent)
    , ui(new Ui::SnapForm)
{
    ui->setupUi(this);
}

SnapForm::~SnapForm()
{
    delete ui;
}

void SnapForm::onOfflineSnapParam(OfflineSnapParam offlineSnapParam)
{
    ui->checkBox_snapEnable->setChecked(offlineSnapParam.enable);
    ui->lineEdit_devSnapPath->setText(offlineSnapParam.path);
    ui->lineEdit_devSnapIntv->setText(QString::number(offlineSnapParam.interval));
    ui->lineEdit_maxCapacity->setText(QString::number(offlineSnapParam.maxCapSize));
    ui->lineEdit_currCapacity->setText(QString::number(offlineSnapParam.dirSize));
}

void SnapForm::on_pushButton_getOfflineSnapParam_clicked()
{
    emit sigGetOfflineSnapParam();
}

void SnapForm::on_pushButton_setOfflineSnapParam_clicked()
{
    OfflineSnapParam offlineSnapParam;
    offlineSnapParam.enable = ui->checkBox_snapEnable->isChecked();
    offlineSnapParam.path = ui->lineEdit_devSnapPath->text();
    offlineSnapParam.interval = ui->lineEdit_devSnapIntv->text().toDouble();
    offlineSnapParam.maxCapSize = ui->lineEdit_maxCapacity->text().toInt();
    offlineSnapParam.dirSize = ui->lineEdit_currCapacity->text().toInt();

    emit sigSetOfflineSnapParam(offlineSnapParam);
}

void SnapForm::on_pushButton_chooseUploadPath_clicked()
{
}

void SnapForm::on_pushButton_upload_clicked()
{
}

void SnapForm::on_pushButton_clearSnap_clicked()
{
	emit sigClearOfflineSnap();
}
